<template>

  <el-tabs v-model="activeName" @tab-click="handleClick" style="padding-left:50px; padding-top: 10px; padding-right: 50px; ">
	<el-tab-pane label="客户管理" name="first" ><Customer ref="Customer"></Customer></el-tab-pane>
    <el-tab-pane label="营销管理" name="second"><Marketing ref="Marketing"></Marketing></el-tab-pane>
    <el-tab-pane label="销售管理" name="third"><Sales ref="Sales"></Sales></el-tab-pane>
    <el-tab-pane label="服务管理" name="fourth"><Service ref="Service"></Service></el-tab-pane>
	<el-tab-pane label="统计数据管理" name="fifth"><Statistics ref="Statistics"></Statistics></el-tab-pane>
	<el-tab-pane label="系统运行管理" name="sixth"><System ref="System"></System></el-tab-pane>
  </el-tabs>

</template>

<script>
	import Customer from './CustomerManagement.vue'
	import Marketing from './Marketing.vue'
	import Sales from './Sales.vue'
	import Service from './Service.vue'
	import Statistics from './Statistics.vue'
	import System from './System.vue'

	export default {
	    data() {
	      return {
	        activeName: 'first'
	      }

	    },
		components: {
			Customer:Customer,
			Marketing:Marketing,
			Sales:Sales,
			Service:Service,
			Statistics:Statistics,
			System:System
		},
    methods: {
      handleClick(tab, event) {
         if(tab.label=='客户管理')
             this.$refs.Customer.getTableData();
          if(tab.label=='营销管理')
             this.$refs.Marketing.getTableData();
          if(tab.label=='销售管理')
             this.$refs.Sales.getTableData();
          if(tab.label=='服务管理')
             this.$refs.Service.getTableData();
          if(tab.label=='统计数据管理')
            this.$refs.Statistics.getTableData();
          if(tab.label=='系统运行管理')
            this.$refs.System.getTableData();
      }
    }
	  };
</script>

<style>
</style>
